Getting the most recent baseline of an Item

I am looping through the modules in a particular project and need to get specific data for each module.  One of these items is the most recent baseline's name and date.  I am having difficulty getting the baseline, however.  I keep getting the error "null Module parameter was passed into argument position 1" when I run the getMostRecentBaseline function.  Here is my code:

Project p;
Folder f;
Module m;
Baseline bl;
Item itemRef;

current = project "/SIM STIM";
for itemRef in current Project do {
    if (type(itemRef) == "Formal") {
        m = module(itemRef);
        fullModName = fullName(itemRef);
        
        tempModName = fullModName;
        modName = name(itemRef);
        f = getParentFolder(itemRef);
        bl = getMostRecentBaseline(m);
        print suffix bl;
        print name(itemRef) " " name(f) "\n";
    }
}

Can someone please tell me what I'm doing wrong?  Why would m be null for all the modules.  If I comment out the getMostRecent line and the print suffix line, I'm still getting values for the name of the module and folder.  If I change name(itemRef) to name(m), I get the same null parameter error message.  So, somehow, changing the item to a module isn't working properly.

 

Chris


Christopher Cote - Wed Apr 10 10:52:13 EDT 2019

Re: Getting the most recent baseline of an Item
Mike.Scharnow - Wed Apr 10 11:47:05 EDT 2019

if I remember correctly, you will have to open the module to use getMotRecentBaseline.

something like

m = read (fullName itemRef, false, true)
bl = getMostRecentBaseline(m)
print ...
close m